package com.zijie.shop.order.api.service.impl;

import com.zijie.order.model.OrderItem;
import com.zijie.order.service.OrderItemService;
import com.zijie.shop.order.api.mapper.OrderItemMapper;
import com.zijie.shop.order.api.service.GoodFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class OrderItemServiceImpl implements OrderItemService {
    private OrderItemMapper orderItemMapper;
    private GoodFeignService goodFeignService;
    @Autowired
    public void setOrderItemMapper(OrderItemMapper orderItemMapper) {
        this.orderItemMapper = orderItemMapper;
    }

    @Autowired
    public void setGoodFeignService(GoodFeignService goodFeignService) {
        this.goodFeignService = goodFeignService;
    }

    @Override
    public List<Map<String, Object>> findOrderItemDetailsByOrderId(Integer id) {
        List<Map<String, Object>> orderItemDetailsByOrderId = orderItemMapper.findOrderItemDetailsByOrderId(id);
        return orderItemDetailsByOrderId;
    }

    @Override
    public boolean saveOrderItem(List<OrderItem> orderItems) {
        return orderItemMapper.saveOrderItem(orderItems) > 0;
    }
}